﻿using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Xml.Linq;
using BLL;
using System.Xml.Serialization;
namespace DBLWebService
{
    /// <summary>
    /// ToolService 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [ToolboxItem(false)]
    // 若要允许使用 ASP.NET AJAX 从脚本中调用此 Web 服务，请取消对下行的注释。
    // [System.Web.Script.Services.ScriptService]
    public class ToolService : System.Web.Services.WebService
    {

        [WebMethod (Description = "返回所有的省份的记录")]
        public DataSet GetAllProvince()
        {
            return ToolBLL.GetAllProvince();
        }

        [WebMethod(Description = "根据省的名字like查找记录")]
        public string ProvinceToCode(string provinceName)
        {
            return ToolBLL.ProvinceToCode(provinceName);
        }

        [WebMethod(Description = "2位数字字符转成省名字")]
        public string CodeToProvince(string code)
        {
            return ToolBLL.CodeToProvince(code);
        }

        [WebMethod(Description = "根据省代码获得省的所有市的记录")]
        public DataSet GetCityByProvinceCode(string provinceCode)
        {
            return ToolBLL.GetCityByProvinceCode(provinceCode);
        }

        [WebMethod(Description = "根据市代码获得所有区的记录")]
        public DataSet GetDistrictByCityCode(string cityCode)
        {
            return ToolBLL.GetDistrictByCityCode(cityCode);
            
        }
        [WebMethod(Description = "根据省代码获得所有区的记录")]
        public DataSet GetDistrictByProvinceCode(string provinceCode)
        {
            return ToolBLL.GetDistrictByProvinceCode(provinceCode);
        }

        [WebMethod(Description = @"生成多巴拉代码 districtCode区县6位代码，businessCode行业4位代码，shopAttribute商铺规模2位代码,type=c 公司 s 商铺 p 个人 o 组织,orgType组织规模代码")]
        public string GenerateDBLNo(string districtCode,string businessCode,string shopAttribute,string type,string orgType)
        {
            return ToolBLL.GenerateDBLNo(districtCode, businessCode, shopAttribute, type, orgType);
        }
        
        [WebMethod(Description = "得到所有组织类型的代码和名称")]
        public DataSet GetAllOrganizationType()
        {
            return ToolBLL.GetAllOrganizationType();
        }

        [WebMethod(Description = "得到所有行业大类的代码和名称")]
        public DataSet GetAllCategory()
        {
            return ToolBLL.GetAllCategory();
        }

        [WebMethod(Description = "根据行业大类得到小类")]
        public DataSet GetClassificationByCategory(string code)
        {
            return ToolBLL.GetClassificationByCode(code);
        }

        [WebMethod(Description = "得到所有店铺规模属性")]
        public DataSet GetAllShopAttribute()
        {
            return ToolBLL.GetAllShopAttribute();
        }
        [WebMethod(Description = "在v_province_city_district_union中查找")]
        public DataSet FindLocationByName(string name)
        {
            return ToolBLL.FindLocationByName(name);
        }
        [WebMethod]
        public DataSet FindLocationByCode(string code)
        {
            return ToolBLL.FindLocationByCode(code);
        }
        

        [WebMethod(Description = "分析多巴拉代码的特征，所属地区，所属行业，是企业、商铺、个人还是组织，商铺规模，组织类型")]
        [XmlInclude(typeof(BLL.ToolBLL.DBLAttribute))]
        public BLL.ToolBLL.DBLAttribute ParseDBLNo(string dblNo)
        {
            return ToolBLL.ParseDBLNo(dblNo);
        }

        

    }
}
